#include<cstdlib>
#include<iostream>
#include<iomanip>
using namespace std;

int main()
{
	int n;
	cin>>n;
	int js=0;
	string a;
	double b;
	bool c;
	for (int i=1;i<=n;i++)
	{
		cin>>a>>b>>c;
		if (b>=37.5 && c)
		{
			cout<<a<<endl;
			js++;
		}
	}
	cout<<js<<endl;
	return 0;
}